{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "50894ccc",
   "metadata": {},
   "source": [
    "# Unity 场景管理和游戏退出\n",
    "\n",
    "## 1. 切换游戏场景\n",
    "注意：需要将场景添加到 Build Settings 的 Scenes in Build 列表中，才能正常切换。\n",
    "\n",
    "### 推荐方法（Unity 2018+）\n",
    "```csharp\n",
    "using UnityEngine.SceneManagement;\n",
    "\n",
    "// 异步加载场景（推荐）\n",
    "SceneManager.LoadScene(\"SceneName\");\n",
    "\n",
    "// 异步加载并显示进度\n",
    "SceneManager.LoadSceneAsync(\"SceneName\");\n",
    "```\n",
    "\n",
    "### 过时方法（Unity 5.3 之前）\n",
    "```csharp\n",
    "Application.LoadLevel(\"SceneName\"); // 已弃用\n",
    "```\n",
    "\n",
    "## 2. 退出游戏\n",
    "```csharp\n",
    "// 编辑器模式下无效，仅在构建的游戏中生效\n",
    "Application.Quit();\n",
    "```\n",
    "\n",
    "### 注意事项\n",
    "- `Application.Quit()` 在 Unity 编辑器中不会退出，只在发布版本中有效。\n",
    "- 如果需要退出编辑器，可以使用 `UnityEditor.EditorApplication.isPlaying = false;`（仅编辑器脚本）。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
